package com.agranee.timesheet.dao;

import java.util.List;

import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.agranee.timesheet.daoable.Employeable;
import com.agranee.timesheet.model.Employee;

public class EmployeeDao extends HibernateDaoSupport implements Employeable  {
	
	
	/*@ManagedProperty(value="#{sessionFactory}")*/
	private SessionFactory sessionFactory;
	
	

  /*public SessionFactory getSessionFactory() {
		return sessionFactory;
	}



	public void setSessionFactory(SessionFactory sessionFactory) {
		this.sessionFactory = sessionFactory;
	}
*/


	@SuppressWarnings("unchecked")
	@Override
	
	public Employee getEmployeeByUserId(String userId) {
		System.out.println("going here");
		
		/*List<Employee> employeeList=getSessionFactory().getCurrentSession().createQuery("from Employee e where e.employeeUserId=?").setParameter(0, userId).list();*/
		List<Employee> employeeList=getHibernateTemplate().find("from Employee e where e.employeeUserId=?", 1);
		return employeeList.get(0);
		
	}



	



	

}
